﻿<%@ Page Title="" Language="C#" MasterPageFile="~/master/m.master" %>

<script runat="server"></script>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <link href="../assets/js/plugins/fancybox/jquery.fancybox.css" rel="stylesheet">
    <link href="../assets/css/shelf/base.css" rel="stylesheet">
    <link href="../assets/css/enterpriseLayout/makePlan.css" rel="stylesheet" />
    <link href="../assets/css/plugins/webuploader/webuploader.css" rel="stylesheet" />
    <link href="../assets/css/plugins/boxdrop/boxDrop.css" rel="stylesheet" />
    <style>
        .tb-head-container {
            padding: 0 0 0 0;
        }

        #tbc .pic {
            width: 40px;
            height: 40px;
            margin: 2px auto;
        }

        #thc span,
        #tbc span {
            display: inline-block;
        }

        .condition {
            padding-top: 5px;
        }

        .loadTable {
            border-bottom: 0px solid #dfdfdd;
            border-left: 0px solid #dfdfdd;
        }

            .loadTable th,
            .loadTable td {
                border-top: 0px solid #dfdfdd;
                border-right: 0px solid #dfdfdd;
                text-align: center;
            }

        .footable-odd {
            background-color: #f3f3f4;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="main" runat="Server">
    <div class="system-box">
        <div class="right-side">
            <div class="btns-container"></div>
            <div class="condition clearfix ">
                <label>店铺</label>
                <input type="text" placeholder="店铺代码或名称" id="search-store" hidden data-value="" />
            </div>
            <div style="overflow: auto; background: #fff;">

                <div class="tb-body-container" id="tbc">
                    <div class="ibox-content">
                        <table class="loadTable table table-stripped container">
                            <thead>
                                <tr>
                                    <th><span>店铺名称</span></th>
                                    <th><span>调出前满场率</span></th>
                                    <th><span>调出前齐码满场率</span></th>
                                    <th><span>调出SKC数量</span></th>
                                    <th><span>调出数量</span></th>
                                    <th><span>调出后满场率</span></th>
                                    <th><span>调出后齐码满场率</span></th>
                                    <th><span>调入SKC数量</span></th>
                                    <th><span>调入数量</span></th>
                                    <th><span>最终满场率</span></th>
                                    <th><span>最终齐码满场率</span></th>
                                </tr>
                            </thead>
                            <tbody class="loadList"></tbody>
                        </table>
                    </div>
                </div>
            </div>
            <div class="pageControl"></div>
        </div>
    </div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="footer" runat="Server">
    <script src="../assets/js/plugins/webuploader/webuploader.min.js"></script>
    <script src="../assets/js/framework.js"></script>
    <script src="../assets/js/plugins/layer/laydate/laydate.js"></script>
    <script src="../assets/js/plugins/fancybox/jquery.fancybox.js"></script>
    <script src="../assets/js/page/pageControl.js"></script>
    <script src="../assets/js/page/tableControl.js"></script>
    <script src="../assets/js/plugins/boxdrop/jquery.boxdrop.js"></script>
    <script>
        $(document).ready(function () {
            //模块ID
            var ModuleID = Y.getUrlParam("ModuleID");
            //获取按钮
            commonUtil.loadBtnList(ModuleID, function () { });

            $('#search-store').boxDrop({ width: 120 });
            $('search-store').on("boxdrop-open", function () {
                $('#search-store').boxDrop("load", { ParentAreaID: $("#search-commodity").val(), ProID: $("#serarch-province").val(), CityID: $("#serarch-city").val() });
            });

            //获取浏览器类型
            var sUserAgent = navigator.userAgent.toLowerCase();

            //计算容器大小
            var calcContainer = function () {
                //计算表格高度
                $('#tbc').height(
                    $('.right-side').height() - $('.condition').outerHeight() - $('.tb-head-container').outerHeight() -
                    (sUserAgent.indexOf('chrome') > -1 ? 109 : 118));
                //计算表格宽度
                $('#tbc').width($('#thc .loadTable').width());
            }

            $(window).resize(function () {
                //重新计算容器高度
                calcContainer();
            })

            //用于记录页数
            var page = 1;
            var loadList = function () {
                pageControl.init('MvFullRate', 'GetList', {
                    ShopIDStr: $('#search-store').val(),
                    Page: page,
                    Size: 100,
                    needLayer: true,
                    alwaysCallBack: function () {
                        $('#tbc .loadList').empty();
                    }
                }, function (result) {
                    page = result.page;
                    var tBody = [];
                    if (!Y.checkNull(result.data)) {
                        var rdi = result.data.Items;
                        if (rdi.length > 0) {
                            rdi.map(function (item, i) {
                                var tempChild = [];
                                tempChild.push({ tdText: '', c: 0, r: 0, tdHtml: '<span ">' + item.ShopName + '</span>', tdId: '', tdClass: '' });
                                tempChild.push({ tdText: '', c: 0, r: 0, tdHtml: '<span ">' + item.OutBeforeFullRate + '</span>', tdId: '', tdClass: '' });
                                tempChild.push({ tdText: '', c: 0, r: 0, tdHtml: '<span ">' + item.OutBeforeBreakSizeFullRate + '</span>', tdId: '', tdClass: '' });
                                tempChild.push({ tdText: '', c: 0, r: 0, tdHtml: '<span ">' + item.OutSKCQty + '</span>', tdId: '', tdClass: '' });
                                tempChild.push({ tdText: '', c: 0, r: 0, tdHtml: '<span ">' + item.OutQty + '</span>', tdId: '', tdClass: '' });
                                tempChild.push({ tdText: '', c: 0, r: 0, tdHtml: '<span ">' + item.OutAfterFullRate + '</span>', tdId: '', tdClass: '' });
                                tempChild.push({ tdText: '', c: 0, r: 0, tdHtml: '<span ">' + item.OutAfterBreakSizeFullRate + '</span>', tdId: '', tdClass: '' });
                                tempChild.push({ tdText: '', c: 0, r: 0, tdHtml: '<span ">' + item.IntSKCQty + '</span>', tdId: '', tdClass: '' });
                                tempChild.push({ tdText: '', c: 0, r: 0, tdHtml: '<span ">' + item.IntQty + '</span>', tdId: '', tdClass: '' });
                                tempChild.push({ tdText: '', c: 0, r: 0, tdHtml: '<span ">' + item.ResultFullRate + '</span>', tdId: '', tdClass: '' });
                                tempChild.push({ tdText: '', c: 0, r: 0, tdHtml: '<span">' + item.ResultBreakSizeFullRate + '</span>', tdId: '', tdClass: '' });

                                var tempTr = {
                                    trClass: (i % 2 == 0 ? 'gradeX footable-even' : 'gradeX footable-odd'),
                                    children: tempChild
                                };
                                tBody.push(tempTr);
                            });
                            tableControl.initTbody('#tbc .loadTable', (tBody.length > 0 ? tBody : null), 0, null);
                            calcContainer();
                            return false;
                        }
                    }
                    calcContainer();
                    $('#tbc .loadList').append(
                        '<tr><td style="width:' + $('#thc th:first').width() + 'px;"><i class="fa fa-frown-o"></i></td>' +
                        '<td style="width:' + ($('#thc .loadTable').width() - $('#thc th:first').width()) + 'px;">无数据</td></tr>');
                });
            }
            loadList();
            calcContainer();

            //查询按钮
            $('.btns-container').on('click', '#btn-search', function () {
                loadList();
            })

            //导出按钮
            $(".btns-container").on("click", '#exportBtn', function () {
                var conditionsArr = [];
                conditionsArr.push({ column: "rate.ShopId", value: $('#search-store').val(), operator: "in_shopids", connector: "and" });
                conditionsArr = JSON.stringify(conditionsArr);
                $.Export({
                    filetype: 'STATISTICSRESULT',
                    filename: '调拔结果统计',
                    conditions: encodeURIComponent(conditionsArr),
                    after: function () {
                        //回调方法
                        //loadList(1);
                        swal("导出成功!");
                    }
                });
            });
        })
    </script>
</asp:Content>

